<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title></title>
		<script src="js/mui.min.js"></script>
		<link href="css/mui.min.css" rel="stylesheet" />
		<script src="js/getURLParam.js"></script>
		<script type="text/javascript" charset="utf-8">
			mui.init( );
			function plusReady(){
 			//这里是其它初始化代码
			//友盟统计
			/*mainActivity = plus.android.runtimeMainActivity();
 			//MobclickAgent = plus.android.importClass(“com.umeng.analytics.MobclickAgent”);
 			MobclickAgent = plus.android.importClass("com.umeng.analytics.MobclickAgent");
			MobclickAgent.onPageStart("MainScreen");*/
 			}
			if(window.plus){
			plusReady();
			}else{
			document.addEventListener("plusready",plusReady,false);
			}
		</script>
		<style type="text/css">
			.mui-content {
				margin-top: 12px;
			}
			
			.mui-input-group {
				margin-left: 2px;
				margin-right: 2px;
			}
		</style>
	</head>

	<body style="background-color: white;">
		<!--<header class="mui-bar mui-bar-nav">
			<h1 class="mui-title">IEMS登陆页面  </h1>
		</header>-->
		<div class="mui-content" style="background-color: white;"> 
			<div align="center" style="height: auto;">
				<img style=" width:100%;height: 100%;"src="images/drawable-login/login_bg-clink.jpg"></img>
			</div>
			<form class="mui-input-group">
				<div class="mui-input-row">
					<!--<label for="">账号</label>-->
					
					<input type="text" class="mui-input mui-input-clear" style="border: thin solid #5B5B5B;" id="account" placeholder="请输入账号" />
				</div>
				<div class="mui-input-row" style="margin-top: 15px;">
					<!--<label for="">密码</label>-->
					<input type="password" class="mui-input mui-input-clear mui-input-password" style="border: thin solid #5B5B5B;" id="password" placeholder="请输入密码" />
				</div>
				<div class="mui-input-row" style="margin-top: 10px;color: red;">
					<!--<label for="">密码</label>-->
					<input id="remindpas" type="checkbox" />记住密码
				</div>
				<!--<button id="login" class="mui-btn mui-btn-block mui-btn-primary" style="background-color: red;border: none;width: 100%;" onclick="loginin()">登陆</button>-->
			</form>
				<button id="login" class="mui-btn mui-btn-block mui-btn-primary" style="background-color: red;border: none;width: 100%;" onclick="loginin()">登陆</button>

		</div>
		<script type="text/javascript">
			//var Token=plus.push.ClientInfo.token;//获取token
			//var imei=plus.device.uuid;//手机串号
			var imei="1";
			var productsflag="3";
			//var accountid=GetQueryString("accountid");
			var accountid="216";
	        var proversion="1.0";
	        //var regtoken=GetQueryString("regtoken");
	       // var regtoken="1";
			var phonetype=GetQueryString("phonetype");
	        var platform=GetQueryString("platform");
	        var sysversion=GetQueryString("sysversion");
	       	//var Token=plus.push.getClientInfo().token;
	       	var Token="1";
			var isTruck="";
			var isEdit="";
			var Accountstate="";
			var conditionsstate="";
			var sessionid="";
			var UserName="";
			function loginin(){
				var account=document.getElementById("account").value;
	        	var passworda=document.getElementById("password").value;
	         mui.ajax(getrequestURL()+'APP/loginIn', {
				data: {
					param: '{"proVersion":"' + proversion + '","accountId":"' + accountid+'","data":{"phoneType":"' + phonetype + '","platForm":"'+platform+'","imeiNum":"'+imei+'","account":"'+account+'","password":"'+passworda+'","regToken":"'+Token+'","productsFlag":"'+productsflag+'"}}'
					/*param: '{"proVersion":"' + proversion + '","accountId":"' + accountid+'","data":{}}'*/
				},
				dataType: 'jsonp', //服务器返回json格式数据
				type: 'get', //HTTP请求类型
				timeout: 10000, //超时时间设置为10秒；
				success: function(data) {
						var jsonObj = window.JSON.parse(data);
						if (jsonObj.resultCode == "1") {
							var resultdata = jsonObj.data;
							accountid=resultdata.accountId;
							UserName=resultdata.UserName;
							 isTruck=resultdata.isTruck;
							 isEdit=resultdata.isEdit;
							 Accountstate=resultdata.Accountstate;
							 conditionsstate=resultdata.conditionsstate;
							 sessionid=resultdata.sessionid;
							/* mainActivity = plus.android.runtimeMainActivity();
 								//MobclickAgent = plus.android.importClass(“com.umeng.analytics.MobclickAgent”);
 								MobclickAgent = plus.android.importClass("com.umeng.analytics.MobclickAgent");*/
								
							//读取本地存储，检查是否为首次启动
							//var showGuide = localStorage.getItem("lauchFlag");
							//if (showGuide) {
								//有值，说明已经显示过了，无需显示；
								//关闭splash页面；
								/*plus.navigator.closeSplashscreen();
								plus.navigator.setFullscreen(false);*/
								//MobclickAgent.onPageEnd("MainScreen");
								/*mui.openWindow("locker-dom.html?sessionid="+sessionid+"&accountId="+accountid+"&proVersion="+proversion+"&conditionsstate="+conditionsstate+"&isTruck="+isTruck);*/
								window.location.href="locker-dom.html?sessionid="+sessionid+"&accountId="+accountid+"&proVersion="+proversion+"&conditionsstate="+conditionsstate+"&isTruck="+isTruck;
							//} else {
								//显示启动导航
								//MobclickAgent.onPageEnd("MainScreen");
								/*mui.openWindow("guide.html?sessionid="+sessionid+"&accountId="+accountid+"&proVersion="+proversion+"&conditionsstate="+conditionsstate+"&isTruck="+isTruck);*/
								//window.location.href="guide.html?sessionid="+sessionid+"&accountId="+accountid+"&proVersion="+proversion+"&conditionsstate="+conditionsstate+"&isTruck="+isTruck
							//}
							localStorage.setItem("lauchFlag","1");
							localStorage.setItem("UserName",UserName);
						}if(jsonObj.resultCode == "101"){
							//MobclickAgent.onPageEnd("MainScreen");
							mui.toast("账户名不存在");
						}if(jsonObj.resultCode == "102"){
							//MobclickAgent.onPageEnd("MainScreen");
							mui.toast("密码错误五次，账户被锁定");
						}if(jsonObj.resultCode == "103"){
							var resultdata = jsonObj.data;
							var passError=resultdata.passError;
							var times=5-passError;
							mui.toast("密码错误,您还有"+times+"次机会");
							//MobclickAgent.onPageEnd("MainScreen");
						}if(jsonObj.resultCode == "99"){//手机串号不一致
							var resultdata = jsonObj.data;
							mui.toast("手机串号不一致");
							//MobclickAgent.onPageEnd("MainScreen");
						}else{
						}
					},
				error: function(xhr, type, errorThrown) {
				}
				});
			}
/*				mui.plusReady(function() {
				//读取本地存储，检查是否为首次启动
				var showGuide = plus.storage.getItem("lauchFlag");
				if (showGuide) {
					//有值，说明已经显示过了，无需显示；
					//关闭splash页面；
					plus.navigator.closeSplashscreen();
					plus.navigator.setFullscreen(false);
				} else {
					//显示启动导航
					mui.openWindow({
						id: 'guide',
						url: 'guide.html',
						show: {
							aniShow: 'none'
						},
						waiting: {
							autoShow: false
						}
					});
				}
				login.addEventListener('tap', function() {
					mui.ajax('http://demo.dcloud.net.cn/test/update/check.php', {
						data: {
							account: account.value,
							password: password.value
						},
						dataType: 'json',
						type: 'get',
						timeout: 3000,
						success: function(returnData) {
							plus.storage.setItem('isExistUserAndPass', '1');
							if (returnData == 2.0) {
								// 设置一个标记，标记是否设置手势密码
								if (plus.storage.getItem('locked') == '1') {
									//手势密码已经设置，进入手势解锁页面
									mui.openWindow({
										url: 'unlock.html',
										id: 'unlock'
									});
								} else {
									//手势未设置，进入手势设置页面
									mui.openWindow({
										url: 'locker-dom.html',
										id: 'locker-dom'
									});
								}
							}
						},
						error: function() {
							// do nothing
							mui.toast('登陆失败');
						}
					})
				});
				//首页返回键处理
				//处理逻辑：1秒内，连续两次按返回键，则退出应用；
				var first = null;
				mui.back = function() {
					//首次按键，提示‘再按一次退出应用’
					if (!first) {
						first = new Date().getTime();
						mui.toast('再按一次退出应用');
						setTimeout(function() {
							first = null;
						}, 1000);
					} else {
						if (new Date().getTime() - first < 1000) {
							plus.runtime.quit();
						}
					}
				};
			});*/
		</script>
	</body>

</html>